<div class="workout">
	<?php //debug($workout); ?>
	<div class="date"><?php echo date( Configure::read('Workout.viewDateFormat') ,$time->toUnix($workout['Workout']['date']))?></div>
	<h2><?php echo $workout['Template']['title'];?></h2>
	<div class="stats-holder">
		<dl class="stats">
			<dd>
				<?php echo $timeUtility->parseTag($workout['Workout']['time_total'], 'time')?>
			</dd>
			<dt><?php __('Total time')?></dt>
		</dl>
		
		<dl class="stats">
			<dd>
				<?php echo $timeUtility->parseTag($workout['Workout']['distance'], 'distance')?>
			</dd>
			<dt><?php __('Distance')?></dt>
		</dl>
		
		<dl class="stats">
			<dd>
				<?php echo $timeUtility->parseTag($workout['Workout']['heartrate'], 'heartrate')?>
			</dd>
			<dt><?php __('Av. heartrate')?></dt>
		</dl>
		
		<dl class="stats">
			<dd>
				<?php echo $timeUtility->parseTag($workout['Template']['power_zone'], 'power_zone')?>
				
			</dd>
			<dt><?php __('Power zone')?> <?php echo $workout['Template']['power_zone']?></dt>
		</dl>
		<dl class="stats">
			<dd>
				<?php echo $timeUtility->parseTag($workout['Template']['Type']['title'], 'type')?>
			</dd>
			<dt><?php __('Type')?></dt>
		</dl>
		<dl class="stats">
			<dd>
				<?php echo $timeUtility->parseTag($workout['Template']['Ability']['title'], 'ability')?>
			</dd>
			<dt><?php __('Ability')?></dt>
		</dl>
		<dl class="stats stats-long">
			<dd>
				<?php echo $timeUtility->parseTag($workout['Template']['location'], 'location')?>
			</dd>
			<dt><?php __('Location')?></dt>
		</dl>
		
		
		
	</div>
	<?php if($workout['Workout']['description'] != ""):?>
		<p><?php echo nl2br($workout['Workout']['description']); ?></p>
	<?php endif; ?>
	<div class="actions">
		<ul>
			<li><?php echo $html->link(__('Done', true), array('action' => 'index'), array('class'=>'btn-3 nyroModalClose')); ?></li>
			<li><?php echo $html->link(__('Edit', true), array('controller'=>'workouts','action' => 'edit', $workout['Workout']['id']), array('class'=>'btn-3 nyroModal')); ?></li>
			<li><?php echo $html->link(__('Delete', true), array('controller'=>'workouts','action' => 'delete', $workout['Workout']['id']), array('class'=>'btn-3', 'id'=>'delete_btn')); ?></li>
		</ul>
	</div>
	<script type="text/javascript">
		jQuery(document).ready(function(){
			<?php if($this->params['isAjax']): ?>
			
			$('#delete_btn').click(function(){
				var url = jQuery(this).attr('href');
				var date = '<?php echo $workout['Workout']['date']?>';
				
				jQuery.ajax({
				   type: "GET",
				   url: url,
				   success: function(data){
					jQuery('#event-holder-'+date).html(data);
					jQuery('#event-holder-'+date).parent().effect("highlight", {}, 3000);
					jQuery('.nyroModalClose').click();
				   }
				 });
				return false;
			})

			<?php endif; ?>
		});
	</script>
</div>
